Questions
30 of 30
1What is the purpose of the transform property in CSS?
2What are the different types of CSS transformations?
3What does transform: translate() do?
4What is the difference between translateX() and translateY()?
5How does rotate() work in CSS?
6What is the unit used in rotation?
7What is the difference between scale() and scaleX(), scaleY()?
8What happens when you use negative values in scale()?
9What does the skew() function do?
10Can you combine multiple transform functions together? How? What is the use of the transform-origin property?
11What is the default transform-origin value?
12How does changing transform-origin affect rotation or scaling?
13What is the difference between translate() and using position or margin for movement?
14What is the difference between 2D and 3D transformations?
15What is the difference between 2D and 3D transformations?
16How do you apply a 3D rotation using CSS?
17How do you apply a 3D rotation using CSS?
18What are perspective and perspective-origin in 3D transforms? What is the purpose of transform-style: preserve-3d?
19What is the use of matrix() in CSS transforms?
20What’s the difference between matrix() and matrix3d()?
21How can you center an element using transform and translate()?
22What is the transition property in CSS used for?
23What are the four main components of a transition?
24What does transition-duration specify?
25What are the common timing function values (e.g., ease, linear, ease-in)?
26What is the shorthand syntax for transition?
27Can multiple CSS properties be transitioned simultaneously? How does transition differ from animation in CSS?
28Can you apply a transition to an element’s pseudo-class (like :hover)?
29Can transitions be triggered by JavaScript?
30What happens if transition-duration is set to 0s?
30 / 30

What happens if transition-duration is set to 0s?

Understanding transition-duration: 0s in CSS

When the transition-duration property is set to 0s, the transition occurs instantly — meaning there is no visible animation between the starting and ending states. The property value changes immediately.

transition-duration defines how long a transition should take to complete. Setting it to 0s disables the transition effect but still keeps the transition properties in place for future use.

Example: transition-duration set to 0s

In this example, when you hover over the box, it instantly expands to 200px width — no smooth transition occurs.

Common Use Cases
  1. 1

    To temporarily disable transitions for specific states (e.g., on page load).

  2. 2

    To instantly reset an element’s state without visual delay.

  3. 3

    To conditionally control transitions through CSS class changes.

If you set transition-duration: 0s, the browser recognizes a transition rule but executes it instantly. If you omit the transition entirely, there’s no transition rule at all. Functionally, both result in immediate property changes, but keeping 0s can help maintain consistent CSS structure.

CSS Example

You can use a .no-transition class to temporarily disable transitions — useful when programmatically changing styles or resetting animations.

Key Takeaways
  1. 1

    transition-duration: 0s means changes happen instantly.

  2. 2

    No animation is visible, but the transition rule still exists.

  3. 3

    It’s useful for toggling or disabling transitions temporarily.